package java8.methodref;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 周宇
 * @create 2020-05-19 17:54
 * 员工
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Employee implements Comparable {
    private String ename;
    private Integer eno;

    //自定义排序方法
    public static int compareByEno(Employee o1, Employee o2) {
        return o1.eno.compareTo(o2.eno);
    }

    @Override
    public int compareTo(Object o) {
        //按 Eno排序
        return this.eno.compareTo(((Employee) o).eno);
    }
}